package org.openbpm.bus.model.xml;

import cn.hutool.core.bean.BeanUtil;
import lombok.Data;
import org.openbpm.bus.model.BusinessObject;

import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;


@XmlRootElement(name = "businessObjectXml")
@XmlAccessorType(XmlAccessType.FIELD)
@Data
public class BusinessObjectXml{

    @XmlElement(name = "relationJson")
    private String relationJson;

    @XmlElements({@XmlElement(name="busTable", type= BusTableXml.class)})
    private List<BusTableXml> busTableList = new ArrayList<BusTableXml>();

    @XmlAttribute
    private String key;

    @XmlAttribute
    private String name;

    @XmlAttribute
    private String desc;

    @XmlAttribute
    private String groupId;

    @XmlAttribute
    private String groupName;


    @XmlAttribute
    private String persistenceType;

    @XmlAttribute
    private String perTypeConfig;

    @XmlAttribute
    private boolean saveIndex;

    public BusinessObjectXml(){

    }

    public BusinessObjectXml(BusinessObject businessObject){
        BeanUtil.copyProperties(businessObject, this);
    }

}
